package com.coolw.dynamic.thread.pool.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 线程池拒绝策略
 *
 * @author coolw
 * @date 2024/5/15 19:14
 */
@Getter
@AllArgsConstructor
public enum RejectedExecutionHandlerEnum {

    DISCARD_OLDEST_POLICY("DISCARD_OLDEST_POLICY", "丢弃队列最前面的任务,然后将当前任务加入到队列"),
    CALLER_RUNS_POLICY("CALLER_RUNS_POLICY", "如果队列满了,则由主线程来执行任务"),
    ABORT_POLICY("ABORT_POLICY", "丢弃任务并抛出异常(线程池默认的拒绝策略)"),
    DISCARD_POLICY("DISCARD_POLICY", "丢弃任务,不抛出异常");

    private final String code;
    private final String message;
}
